﻿<%@ Page Title="我的商品评论" Language="C#" MasterPageFile="~/Wap/Shop/ShopSite.Master" AutoEventWireup="true" CodeBehind="ProductComment.aspx.cs" Inherits="ZLCMS.Web.Wap.Shop.ProductComment" %>

<%@ Import Namespace="ZLCMS.Business.Util" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <!--E banner-->
    <style type="text/css">
	#mypage .ui-footer{ background:#dadada; border-top:1px solid #ddd; padding:5px 0;}
	#mypage .ui-footer .ui-btn{ width:70%;}
	#mypage .ui-footer{ background:#fff;}
    </style>

    
    <script type="text/javascript">
        shareUrl = location.href; //分享链接
        shareTitle = '我的商品评论'; //分享标题
        shareLogo = '<%=ServerUtil.GetRootURI() %>/wap/shop/images/logo.png'; //分享图标
        shareDesc = '<%= ParamKit.GetValue("SystemConfig", "Desciption", "&nbsp") %>'; //分享描述
    </script>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="pages" runat="server">
<!--S page -->
<div data-role="page" class="loaderHandler ProductComment" id="mypage" style="background-color: #fafafa;">

	<!--S header -->
	<div data-role="header">
	</div>
    <!--E header -->
	
    <!--S content -->
	<div role="main" class="ui-content">
          <div data-role="navbar">
            <div class="headerbtn">
            <a data-ajax="false" href="/wap/shop/productdetail.aspx?no=<%=Request["no"] %>"><img src="images/arrowLeftCom.png" /></a></div>
            <ul class="header">
              <li <%= ScoreMax==9?"class='active'":"" %>><a href="/wap/shop/ProductComment.aspx?no=<%=Request["no"]%>" data-ajax="false">
                <p>全部</p>
                <p>（<font id='counter0'></font>）</p>
                </a></li>
              <li  <%=ScoreMax==5?"class='active'":"" %>><a href="/wap/shop/ProductComment.aspx?no=<%=Request["no"]%>&min=5&max=5" data-ajax="false">
                <p>好评</p>
                <p>（<font id='counter1'></font>）</p>
                </a></li>
              <li  <%=ScoreMax==4?"class='active'":"" %>><a href="/wap/shop/ProductComment.aspx?no=<%=Request["no"]%>&min=3&max=4" data-ajax="false">
                <p>中评</p>
                <p>（<font id='counter2'></font>）</p>
                </a></li>
              <li  <%=ScoreMax==2?"class='active'":"" %>><a href="/wap/shop/ProductComment.aspx?no=<%=Request["no"]%>&min=1&max=2" data-ajax="false">
                <p>差评</p>
                <p>（<font id='counter3'></font>）</p>
                </a></li>
            </ul>
          </div>

        <div class="content">
         <%--  <div class="evaluate_box">
                <div>
                    <span>用户:bus***</span>
                    <p>2015-12-05 08:46:23</p>
                </div>
                <div>
                    <p>评分：</p>
                    <ul>
                        <li class="active"></li>
                        <li class="active"></li>
                        <li class="active"></li>
                        <li></li>
                        <li></li>
                    </ul>
                </div>
                <div>
                    我的最爱,味道可口。我的最爱,味道可口。我的最爱,味道可口。我的最爱,味道可口。我的最爱,味道可口。我的最爱,味道可口。
                </div>
                <div>
                    <ul>
                        <li><img src="images/commentImg.jpg" /></li>
                        <li><img src="images/commentImg.jpg" /></li>
                        <li><img src="images/commentImg.jpg" /></li>
                        <li><img src="images/commentImg.jpg" /></li>
                        <li><img src="images/commentImg.jpg" /></li>
                    </ul>
                </div>
            </div> --%>
        </div>
    </div>
    <!--E content -->
	
    <!--S footer -->
<%--	<div data-role="footer" data-position="fixed" data-tap-toggle="false" data-theme="g">
    	<div class="details_footer">
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><a href="Default.aspx" data-ajax="false"><img src="images/shopHome.png"></a></td>
            <td>
            	<ul>
                	<li id="bt_buynow"><a href="javascript:void(0);" onclick="submitOrder($(this))">立即购买&nbsp;</a></li>
                    <li id="bt_addcart"><a href="javascript:void(0);" onclick="selectProduct($(this))">加入购物车</a></li>
                </ul>
            </td>
            <td><a href="ShoppingCart.aspx" data-ajax="false"><img src="images/shopcar.png"><div class="cart_posi" prop="CartProductNum"></div></a></td>
          </tr>
        </table>

        </div>
    </div>--%>
    <!--E footer -->
</div>
<script src="js/skuHandler.js" type="text/javascript"></script>
<script src="/wap/lib/common/listviewHandler.js" type="text/javascript"></script>
<script src="/wap/lib/common/loaderHandler.js" type="text/javascript"></script>
<script src="/wap/lib/easydialog/easydialog.min.js" type="text/javascript"></script>
<script type="text/javascript">
    function loadCommentList() {
        var handler = $('.content').listviewHandler();
        handler.initialize({
            loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
            emptyHtml: '<div class="evaluate_box evaluate_box_normal">-- 暂无评论 --</div>', //无记录时显示此html
            itemTemplate: '<div class="evaluate_box">' +
                '<div class="allcomm">' +
                    '<span>用户:{MemberName}</span>' +
                    '<p>{RecordDate}</p>' +
                '</div>' +
                '<div>' +
                    '<p>评分：</p>' +
                    '<ul>{ScoreHtml}</ul>' +
                '</div>' +
                '<div>{Content}</div>' +
                '<div>{ImgHtml}</div>' +
                '{ReplayHtml}' +
             '</div>',
            pageIndex: 1, //页码（从1起算）
            pageSize: 20, //页大小
            totalCount: 999, //总记录数
            itemHandler: function (data, itemTemplate, container) {//数据各项处理
                if (!data.Comment) { return; };
                data.Comment.ScoreHtml = '';

                var i = 0;
                for (; i < data.Comment.Score; i++) {
                    data.Comment.ScoreHtml += '<li class="active"></li>';
                }
                for (; i < 5; i++) {
                    data.Comment.ScoreHtml += '<li></li>';
                }
                data.Comment.ImgHtml = '';
                try {
                    var imgList = $.parseJSON(data.Comment.ImageUrl);
                    if (imgList.length > 0) { data.Comment.ImgHtml = '<ul>'; }
                    $(imgList).each(function () {
                        data.Comment.ImgHtml += '<li><img src="' + this.FilePath + '" /></li>';

                    });
                    if (imgList.length > 0) { data.Comment.ImgHtml += '</ul>'; }
                } catch (e) { }

                var repTemp = '                <div class="manager">' +
                     '<div>' +
                        ' <span>[{MemberName}]：</span><p>{RecordDate}</p>' +
                     '</div>' +
                     '<div>' +
                         '{Content}' +
                     '</div>' +
                 '</div>';
                data.Comment.ReplayHtml = '';
                $(data.Comment.ReplyList).each(function () {
                    data.Comment.ReplayHtml += repTemp.format(this.Comment);
                });

                return itemTemplate.format(data.Comment);
            },
            afterHandleResult: function (result, totalCount, container) {
                var countObj = { all: 0, good: 0, notbad: 0, bad: 0 };
                $(result.ScoreCounter).each(function () {
                    if (this.score == 5) { countObj.good += this.counter };
                    if (this.score == 4 || this.score == 3) { countObj.notbad += this.counter };
                    if (this.score == 2 || this.score == 1) { countObj.bad += this.counter };
                    countObj.all += this.counter;
                });
                $('#counter0').text(countObj.all);
                $('#counter1').text(countObj.good);
                $('#counter2').text(countObj.notbad);
                $('#counter3').text(countObj.bad);
            },
            command: 'Pub.LoadCommentList',
            parameter: { TargetKind: 'PRODUCT', TargetCode: '<%=Request["no"]%>', ScoreMax: '<%=ScoreMax %>', ScoreMin: '<%=ScoreMin %>' }
        });
        handler.nextPage();
    }

    $(function () {
        loadCommentList();
    });
</script>


</asp:Content>